<template>
  <el-container>
    <basic-crud v-model="formData" :option="option" businessUrl="/org/personController">
    </basic-crud>
  </el-container>
</template>

<script setup>
const formData = ref({})
const option = {
  menuWidth: 250,
  statusBtn: true,
  column: [
    {
      prop: "code",
      label: "编号",
      type: "input",
      maxLength: "50",
    },
    {
      prop: "name",
      label: "名称",
      type: "input",
      maxLength: "250",
    },
    {
      prop: "personClassify",
      label: "员工类型",
      dicCode: "personClassify",
      type: "select",
      value: "员工",
    },
    {
      prop: "formerName",
      label: "曾用名",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "lastName",
      label: "姓",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "firstName",
      label: "名",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "englishName",
      label: "英文名称",
      type: "input",
      maxLength: "240",
    },
    {
      label: "所属部门",
      prop: "departmentName",
      fieldKey: 'department',
      sortable: true,
      component: 'BasicCrudInputTree',
      referType: 'dep',
      saveFieldMap: { departmentName: 'name', department: 'id' },
      curForm: formData,
      change: (val) => {
        formData.value = val
      },
      width: 150,
    },
    {
      label: "所属岗位",
      prop: "positionName",
      fieldKey: 'position',
      sortable: true,
      component: 'BasicCrudInputTree',
      referType: 'position',
      saveFieldMap: { positionName: 'name', position: 'id' },
      curForm: formData,
      change: (val) => {
        formData.value = val
      },
      width: 150,
    },
    {
      prop: "leaderName",
      label: "直属领导名称",
      component: 'BasicCrudTableSelect',
      // 内置参照名称
      dataType: 'user',
      width: 150,
      comProps: {
        saveFieldMap: { leaderName: 'name', leader: 'id' },
      },
      curForm: formData,
      change: (newV) => {
        formData.value = newV
      },
    },
    {
      prop: "sex",
      label: "性别",
      dicCode: "sex",
      type: "select",
    },
    {
      prop: "birthdayDate",
      label: "出生日期",
      type: "datetime",
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    {
      prop: "idType",
      label: "证件类型",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "idCard",
      label: "证件号",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "workerTypeName",
      label: "工种",
      fieldKey: 'workerType',
      sortable: true,
      component: 'BasicCrudInputTree',
      referType: 'workType',
      saveFieldMap: { workerTypeName: 'name', workerType: 'id' },
      curForm: formData,
      change: (val) => {
        formData.value = val
      },
    },
    {
      prop: "marriage",
      label: "婚姻状况",
      dicCode: "marriage",
      type: "select",
    },
    {
      prop: "nation",
      label: "民族",
      type: "input",
      maxLength: "240",
      value: "汉",
    },
    {
      prop: "hometown",
      label: "籍贯",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "photo",
      label: "头像文件主键",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "political",
      label: "政治面貌",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "englishLevel",
      label: "英语水平",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "culture",
      label: "教育学历",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "jobDegree",
      label: "在职教育学历",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "school",
      label: "毕业院校",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "address",
      label: "联系地址",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "tel",
      label: "办公电话",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "homeTel",
      label: "家庭电话",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "email",
      label: "邮件地址",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "title",
      label: "职称",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "techPosition",
      label: "技术职称",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "beginJobDate",
      label: "开始工作日期",
      type: "datetime",
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    {
      prop: "jobDate",
      label: "入职日期",
      type: "datetime",
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    {
      prop: "contractLength",
      label: "合同年限",
      type: "input",
      maxLength: "240",
    },
    {
      prop: "endJobDate",
      label: "离职日期",
      type: "date",
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
    {
      prop: "des",
      label: "描述",
      span: 24,
      type: "textarea",
      maxLength: "250",
    },
  ],
}
</script>

<style lang="scss" scoped></style>
